wintab: fix skipping of odd-numbered devices
authorAndrew Chadwick <a.t.chadwick@gmail.com>
Sat, 19 Nov 2016 03:26:29 +0000 (03:26 +0000)
committerIgnacio Casal Quinteiro <icq@gnome.org>
Mon, 21 Nov 2016 18:11:09 +0000 (19:11 +0100)
Fix a regression introduced in 4ce6d1060104e7072eec347370999bfd3fe69dc0
which causes devices with an odd-numbered zero-based index in the list
to be passed over incorrectly. This might present as yet another "device
does not send pressure" bug for ~50% of devices out there.

This commit also closes off another potential segfault for wintab_devices
lists which have an odd length.

https://bugzilla.gnome.org/show_bug.cgi?id=774699

gdk/win32/gdkdevicemanager-win32.c

index 7c8794ff59b822ba52b4259d0573a0dfb482761d..9f1f39105d3349c6bde6457bda29fe9b46d450d9 100644 (file)
@@ -852,10 +852,9 @@ gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
   GdkDeviceWintab *device;
   GList *tmp_list;
 
-  for (tmp_list = device_manager->wintab_devices; tmp_list; tmp_list = tmp_list->next)
+  for (tmp_list = device_manager->wintab_devices; tmp_list != NULL; tmp_list = tmp_list->next)
     {
       device = tmp_list->data;
-      tmp_list = tmp_list->next;
 
       if (device->hctx == hctx &&
           device->cursor == cursor)